package com.example.xunua_mymusic.utils;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.example.xunua_mymusic.R;
import com.example.xunua_mymusic.fragment.localMusicFragment;
import com.example.xunua_mymusic.fragment.mainFragment;

import java.util.ArrayList;

public class FragmentUtils{
    public void show(FragmentManager fragmentManager,int i){
        FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
        Fragment fragment1=new mainFragment();
        Fragment fragment2=new localMusicFragment();
        Fragment[] fragments={fragment1,fragment2};
        fragmentTransaction.replace(R.id.main_fragment,fragments[i]);
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();
    }
}
